/*
 * Copyright (c) 2013-2018 上海汇数数据. All rights reserved.
 * @(#) AsymmetricCipherParams.java 2018-08-06 17:26
 */

package cn.jh.common.core.crypto;

import org.inferred.freebuilder.FreeBuilder;


/**
 * 非对称加密算法参数数据。
 *
 * @author Fuchun
 * @since 1.0
 */
@FreeBuilder
public abstract class AsymmetricCipherParams extends CipherParams {

    /** 非对称加密的签名算法名称。*/
    public abstract String getSignatureAlgorithm();

    public static class Builder extends AsymmetricCipherParams_Builder {

        public Builder() {
            setProvider(CipherKt.SUN_JCE);
            setStreamingBufferSize(CipherKt.DEFAULT_STREAMING_BUFFER_SIZE);
            // 非对称加密算法最低要求 1024 bit 密钥
            setKeySize(1024);
        }

        public Builder useDefaultSecureRandom() {
            return setSecureRandom(CipherKt.getDefaultSecurRandom());
        }
    }
}
